package haha.life.common;


import haha.life.normal.CommonConvertUtils;
import haha.life.normal.FileUtil;
import jzqb.bo.DBBo;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class Construction {

    @Bean
    public void constructValue() {
        String jsonResult = FileUtil.readJsonFile("db.json");
        List<DBBo> dbBoList = CommonConvertUtils.getJsonToList(jsonResult, DBBo.class);
        for (DBBo dbBo : dbBoList) {
            if (dbBo.getKey().equals("QBZYUAN")) {
                SysTool.QBZS_METADATA = dbBo.getDbCode();
            } else if (dbBo.getKey().equals("YJCG")) {
                SysTool.QBCG_METADATA = dbBo.getDbCode();
            } else if (dbBo.getKey().equals("QBZY")) {
                SysTool.QBZY_METADATA = dbBo.getDbCode();
            } else if (dbBo.getKey().equals("BKCT")) {
                SysTool.QBBK_METADATA = dbBo.getDbCode();
            }
        }
    }
}
